package client; 
import java.io.*; 
import java.util.*; 

public class Configuration { 
private Properties config=new Properties();//璁板綍閰嶇疆椤�� 

private String fn=null;

public Configuration(){ 
try { 
FileInputStream fin = new FileInputStream("src/client/client.conf"); 
config.load(fin); //杞藉叆鏂囦欢 
fin.close(); 
} 
catch (IOException ex) { 

} 
fn="client.conf"; 
} 

public String getRmiAddress(){
	return "//"+this.getValue("server_address")+":"+this.getValue("rmi_port")+"/";

}




public String getValue(String itemName){ 
return config.getProperty(itemName); 
} 

public String getValue(String itemName, 
String defaultValue){ 
return config.getProperty(itemName,defaultValue); 
} 

//璁剧疆閰嶇疆椤瑰悕绉板強鍏跺���� 
public void setValue(String itemName,String value){ 
config.setProperty(itemName,value); 
return; 
} 

public void saveFile(String fileName,String description) 
{ 
try { 
FileOutputStream fout 
= new FileOutputStream(fileName); 
config.store(fout, description);//淇濆瓨鏂囦欢 
fout.close(); 
} 
catch (IOException ex) { 
} 
} 

//淇濆瓨閰嶇疆鏂囦欢锛屾寚瀹氭枃浠跺悕 
public void saveFile(String fileName) 
{ 
saveFile(fileName,""); 
} 

public void saveFile(){ 
if(fn.length()==0) 
saveFile(fn); 
} 
} 
